import hyRequest from '../index'

export interface navItem{
  id:string,
  text:string
}
interface navListResult{
  code:number,
  result:[navItem]
}
export const getNavList=() =>{
  return hyRequest.get<navListResult>({
    url: '/navList'
  })
}

export interface swipeItem{
  link:string
  imgSrc:string
}
interface swipeListResult{
  code:number,
  result:[swipeItem]
}
export const getSwipeList = () =>{
  return hyRequest.get<swipeListResult>({
    url:'/swiperList'
  })
}

export interface videoItem {
  author?: string
  authorIconSrc?: string
  commentCount?: number
  date?: string
  id?: string
  poster?: string
  playCount?: string
  likeCount?: string
  favCount?: string
  videoSrc?: string
  videoTitle?: string
}
interface videoResult {
  code:number,
  result: videoItem
}
export const getVideoDetails = (data:any) =>{
  return hyRequest.get<videoResult>({
    url:'/videoDetail',
    params:data
  })
}

export interface videoListItem {
  id: number;
  imgSrc: string;
  desc: string;
  playCount: string;
  commentCount: string;
  videoSrc: string;
  }
interface videoListResult{
  code:number,
  result:[videoListItem]
}
export const getVideoList = () =>{
  return hyRequest.get<videoListResult>({
    url:'/videosList'
  })
}

export interface videoCommentItem{
  id: string
  date: string
  content: string
  avatar: string
  username: string
}
interface videoCommentResult{
  code:number,
  result:{
    count:number,
    items:[videoCommentItem]
  }
}
export const getVideoComments = () =>{
  return hyRequest.get<videoCommentResult>({
    url:'/commentsList'
  })
}

interface videoRecommendResult{
  code:number,
  result:[videoListItem]
}
export const getVideoRecommends = () =>{
  return hyRequest.get<videoRecommendResult>({
    url:'/recommendList'
  })
}